

cat << EOF > $K8_CONFIG_HOME/kube-proxy

KUBE_PROXY_OPTS="--logtostderr=true \
    --v=4 \
    --hostname-override=$K8_HOST \
    --cluster-cidr=$K8_CLUSTER_IP_RANGE \
    --kubeconfig=$K8_CONFIG_HOME/kube-proxy.kubeconfig"

EOF

currentPath=$(pwd)
cat << EOF > $currentPath/build/service/kube-proxy.service
[Unit]
Description=Kubernetes Proxy
After=network.target
 
[Service]
EnvironmentFile=$K8_CONFIG_HOME/kube-proxy
ExecStart=$K8_NODE_BIN/kube-proxy \$KUBE_PROXY_OPTS
Restart=on-failure
 
[Install]
WantedBy=multi-user.target

EOF


sed -i '/kube-proxy/d' $K8_NODE_SHELL
sed -i "/daemon-reload/i\cp $currentPath/build/service/kube-proxy.service" $K8_NODE_SHELL

echo "systemctl enable kube-proxy" >> $K8_NODE_SHELL
echo "systemctl stop kube-proxy " >> $K8_NODE_SHELL
echo "systemctl start kube-proxy " >> $K8_NODE_SHELL
